/*
 * modes.h
 *
 * Created: 09.01.2013 13:54:17
 *  Author: clemens
 */ 


#ifndef MODES_H_
#define MODES_H_
#include <stdint.h> 

volatile uint8_t mode_id;
volatile uint8_t refreshtime;
volatile uint8_t touchcountertime;
//volatile uint8_t modeselector_on;
volatile uint32_t touchmem ;
uint16_t ct_global;
uint16_t ct_global_2;
uint8_t global_uint8;
uint8_t global_uint8_2;
uint8_t global_uint8_3;
int8_t global_int8;
int8_t global_int8_2;
int8_t global_int8_3;
int32_t global_int32;
int32_t global_int32_2;
int32_t global_int32_3;
//uint8_t rotationselector;
uint8_t last_pressed ;
uint16_t last_pressed_t;
int8_t global_array_1[25];
int8_t global_array_2[25];
int8_t global_array_3[25];
int8_t global_array_4[25];
uint32_t global_array_uint32[3];


// globales ct_led entfernen!!!


// text_farb_wahl defines

#define cycle_done global_uint8
#define modefirstcall2 global_uint8_2
#define letter_left global_int32_3
#define letter_right global_int32_2

// flasche

#define x1 global_int8
#define y1 global_int8_2
#define x2 global_uint8
#define y2 global_uint8_2
#define direction global_uint8_3
#define cnt_int global_int8_3
#define time_start global_int32
#define time_end global_int32_2

// touch response defines

#define rand_color_r global_array_1
#define rand_color_g global_array_2
#define rand_color_b global_array_3

// fade wave defines

#define circle_brightness global_array_4
#define x_cir global_uint8
#define y_cir global_uint8_2
#define in_fade_wave global_int8

// Random fade defines ////////////////////////

#define fade_stop_r global_array_1
#define fade_stop_g global_array_2
#define fade_stop_b global_array_3
//#define random_fade_num global_uint8
#define in_fade global_array_uint32

// paintonec defines
	
#define ct_led global_int32
#define pixelcolour global_int32_2

// Muster fade defines

#define muster_new global_int32
#define muster_old global_int32_2
#define fade_wert global_array_1
#define muster_wahl global_uint8

// Muster farb wahl

#define muster global_int32
#define muster_counter global_uint8_2
#define farb_wert global_array_1

// Snake defines //////////////////////////////
#define snake_body_x global_array_1
#define snake_body_y global_array_2
#define body_len global_uint8
#define kill global_uint8_2
#define feeding_x global_int8
#define feeding_y global_int8_2


// Modeselector defines ///////////////////////

#define min_wert_feld 20
#define mid_wert_feld 35
#define max_wert_feld 50
#define direction_wave global_array_1
#define direction_run global_uint8

// Color game defines

#define color_memory global_array_1
#define input_memory global_array_2
#define game_over global_uint8
#define ct_farbe global_uint8_2
#define black_screen global_int8

// Black hole defines

#define green_x global_array_1
#define green_y global_array_2
#define red_x global_array_3
#define red_y global_array_4



void check_for_cali(void);
void readtouch();
void rainbow(void);
void calibration(void);
void changetouchstatus(void);
void modeselector(void);
void paintonec(uint8_t colourchange, uint8_t paint_r, uint8_t paint_g,uint8_t paint_b );
void run_mode(uint8_t mode_id); //TODO evtl die volatile mode_id durch nicht volatile ersetz
void touchmenue(uint8_t modeselector_on,uint8_t responsered,uint8_t responsegreen,uint8_t responseblue);

#endif /* MODES_H_ */